<%@page contentType="text/html" import="java.util.*" %>
<%@page contentType="text/html" import="java.text.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome to Date Change Application</title>
<link rel="stylesheet" type="text/css" href="css/table-column-options.css" />
<script type="text/javascript" src="js/datechange.js"></script>
<script language="JavaScript" type="text/JavaScript">
function disabled(){
	<%
	String host =  (String) session.getAttribute("host");
	String renewalDateStr =  (String) request.getAttribute("renewalDateStr");
	String billingDateStr =  (String) request.getAttribute("billingDateStr");
	if("REMOTE".equals(host)){
	%>
	  document.getElementById("dateChangeBtn").disabled=true;
	  document.getElementById("dateChange_R_45_Btn").disabled=true;
	  document.getElementById("dateChange_R_35_Btn").disabled=true;
	  document.getElementById("dateChange_R_30_Btn").disabled=true;

	  document.getElementById("dateChange_dd1_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd2_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd3_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd4_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd5_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd6_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd7_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd8_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd9_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd10_20_Btn").disabled=true;

	<%
	}if(renewalDateStr == null){
	%>
	  document.getElementById("dateChange_R_45_Btn").disabled=true;
	  document.getElementById("dateChange_R_35_Btn").disabled=true;
	  document.getElementById("dateChange_R_30_Btn").disabled=true;
	<%
	}if(billingDateStr == null){
	%>
	  document.getElementById("dateChange_dd1_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd2_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd3_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd4_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd5_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd6_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd7_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd8_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd9_20_Btn").disabled=true;
	  document.getElementById("dateChange_dd10_20_Btn").disabled=true;
	 <%
	}
	%>
}
</script>
</head>
<body onload="disabled()">
<form action="datechange.do" method="post" name="dateForm">
<table  width="100%">
	<tr>
		<td>
			<table class="column-options" width="100%">
				<tr>
					<th>
						<h2><font color="white"> Current date from Internet :${internet_date} </font><font color="black">             System date :${systemDate} </font></h2>
					</th>
				</tr>
				<tr class="even">
			      <td align="center">
					To Change System Date Enter Date (01/24/2013) :
					<input id="date" type="text" id="date" name="date" size="10" value="${inputDate}"/>
					<input type="submit" name="dateChangeBtn" value="Change Date" onClick="return validateDate('date')"/>
				  </td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table class="column-options" width="100%">
				<tr>
					<th>
						Date Calculator
					</th>
				</tr>
				<tr>
					<td>
						<table class="column-options" width="100%">
							<tr>
								<th>
									Renewal
								</th>
								<th>
									Billing
								</th>
							</tr>
							<tr class="even">
						      <td align="center">
								Enter Renewal Date (01/24/2013) : <input id="renewalDate" type="text" id="renewalDate" name="renewalDate" size="10" value="${renewalDateStr}" }/>
								<input type="hidden" name="r_date_hidden" value="${renewalDateStr}" />
								<input type="submit" name="renewalDateBtn" value="Get Renewal Related Date"  onClick="return validateDate('renewalDate')"/>
							  </td>
						      <td align="center">
								Enter Effective Date (01/24/2013) : <input id="billingDate" type="text" id="billingDate" name="billingDate" size="10" value="${billingDateStr}"/>
								<input type="hidden" name="b_date_hidden" value="${billingDateStr}" />
								<input type="submit" name="billingDateBtn" value="Get Billing Related Date"  onClick="return validateDate('billingDate')"/>
							  </td>
							</tr>

							<tr valign="top">
								<td>
									<table class="column-options" width="100%">
										<tr>
											<th>
												Time Line
											</th>
											<th>
												Date
											</th>
											<th>
												Button
											</th>
										</tr>
										<tr class="odd">
											<td>
												R-45
											</td>
											<td>
												${renewal_R_45}
											</td>
											<td>
												<input type="hidden" name="r_45_hidden" value="${renewal_R_45}" />
												<input type="submit" name="dateChange_R_45_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr>
											<td>
												R-35
											</td>
											<td>
												${renewal_R_35}
											</td>
											<td>
											    <input type="hidden" name="r_35_hidden" value="${renewal_R_35}" />
												<input type="submit" name="dateChange_R_35_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr class="odd" >
											<td>
												R-30
											</td>
											<td>
												${renewal_R_30}
											</td>
											<td>
											    <input type="hidden" name="r_30_hidden" value="${renewal_R_30}" />
												<input type="submit" name="dateChange_R_30_Btn" value="Set To System Date" />
											</td>
										</tr>
									 </table>
								</td>
								<td>
									<table class="column-options" width="100%">
										<tr>
											<th>
												Time Line
											</th>
											<th>
												Date
											</th>
											<th>
												Button
											</th>
										</tr>
										<tr>
											<td>
												DD1-20
											</td>
											<td>
												${billing_dd1_20}
											</td>
											<td>
												<input type="hidden" name="dd1_20_hidden" value="${billing_dd1_20}" />
												<input type="submit" name="dateChange_dd1_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr class="odd">
											<td>
												DD2-20
											</td>
											<td>
												${billing_dd2_20}
											</td>
											<td>
												<input type="hidden" name="dd2_20_hidden" value="${billing_dd2_20}" />
												<input type="submit" name="dateChange_dd2_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr>
											<td>
												DD3-20
											</td>
											<td>
												${billing_dd3_20}
											</td>
											<td>
												<input type="hidden" name="dd3_20_hidden" value="${billing_dd3_20}" />
												<input type="submit" name="dateChange_dd3_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr class="odd">
											<td>
												DD4-20
											</td>
											<td>
												${billing_dd4_20}
											</td>
											<td>
												<input type="hidden" name="dd4_20_hidden" value="${billing_dd4_20}" />
												<input type="submit" name="dateChange_dd4_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr>
											<td>
												DD5-20
											</td>
											<td>
												${billing_dd5_20}
											</td>
											<td>
												<input type="hidden" name="dd5_20_hidden" value="${billing_dd5_20}" />
												<input type="submit" name="dateChange_dd5_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr class="odd">
											<td>
												DD6-20
											</td>
											<td>
												${billing_dd6_20}
											</td>
											<td>
												<input type="hidden" name="dd6_20_hidden" value="${billing_dd6_20}" />
												<input type="submit" name="dateChange_dd6_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr>
											<td>
												DD7-20
											</td>
											<td>
												${billing_dd7_20}
											</td>
											<td>
												<input type="hidden" name="dd7_20_hidden" value="${billing_dd7_20}" />
												<input type="submit" name="dateChange_dd7_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr class="odd">
											<td>
												DD8-20
											</td>
											<td>
												${billing_dd8_20}
											</td>
											<td>
												<input type="hidden" name="dd8_20_hidden" value="${billing_dd8_20}" />
												<input type="submit" name="dateChange_dd8_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr>
											<td>
												DD9-20
											</td>
											<td>
												${billing_dd9_20}
											</td>
											<td>
												<input type="hidden" name="dd9_20_hidden" value="${billing_dd9_20}" />
												<input type="submit" name="dateChange_dd9_20_Btn" value="Set To System Date" />
											</td>
										</tr>
										<tr class="odd">
											<td>
												DD10-20
											</td>
											<td>
												${billing_dd10_20}
											</td>
											<td>
												<input type="hidden" name="dd10_20_hidden" value="${billing_dd10_20}" />
												<input type="submit" name="dateChange_dd10_20_Btn" value="Set To System Date" />
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
</body>
</html>
